﻿using Heb2RusEngine;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Heb2RusTests
{
    [TestClass]
    public class Tests_IssueTracker
    {
        [TestMethod]
        public void Test_Issue_302()
        {
            const string hebrewInput = "פּשְׁעִים";
            const string expectedRussianResult = "пошеим";
            Hebrew2RussianTranslit translit = new Hebrew2RussianTranslit();
            string actualRussianResult = translit.ConvertLine(hebrewInput);
            Assert.AreEqual(expectedRussianResult, actualRussianResult);
        }
        [TestMethod]
        public void Test_Issue_304()
        {
            const string hebrewInput = "בָּךְ";
            const string expectedRussianResult = "бах";
            Hebrew2RussianTranslit translit = new Hebrew2RussianTranslit();
            string actualRussianResult = translit.ConvertLine(hebrewInput);
            Assert.AreEqual(expectedRussianResult, actualRussianResult);
        }
        [TestMethod]
        public void Test_Issue_305()
        {
            string hebrewInput = "כָּל";
            string expectedRussianResult = "коль";
            Hebrew2RussianTranslit translit = new Hebrew2RussianTranslit();
            string actualRussianResult = translit.ConvertLine(hebrewInput);
            Assert.AreEqual(expectedRussianResult, actualRussianResult);

            hebrewInput = "כָּל.";
            expectedRussianResult = "коль.";
            actualRussianResult = translit.ConvertLine(hebrewInput);
            Assert.AreEqual(expectedRussianResult, actualRussianResult);
        }
        [TestMethod]
        public void Test_Issue_306()
        {
            const string hebrewInput = "בַּיהֹוָה";
            const string expectedRussianResult = "бА-доной";
            Hebrew2RussianTranslit translit = new Hebrew2RussianTranslit();
            string actualRussianResult = translit.ConvertLine(hebrewInput);
            Assert.AreEqual(expectedRussianResult, actualRussianResult);
        }
        [TestMethod]
        public void Test_Issue_326()
        {
            const string hebrewInput = "יְרוּשָׁלָיִם";
            const string expectedRussianResult = "йерушалайим";
            Hebrew2RussianTranslit translit = new Hebrew2RussianTranslit();
            string actualRussianResult = translit.ConvertLine(hebrewInput);
            Assert.AreEqual(expectedRussianResult, actualRussianResult);
        }
        [TestMethod]
        public void Test_Issue_329_lamed()
        {
            const string hebrewInput = "לַיהֹוָה";
            const string expectedRussianResult = "лА-доной";
            Hebrew2RussianTranslit translit = new Hebrew2RussianTranslit();
            string actualRussianResult = translit.ConvertLine(hebrewInput);
            Assert.AreEqual(expectedRussianResult, actualRussianResult);
        }
        [TestMethod]
        [Ignore]
        public void TestSampleFromLJ()
        {
            const string hebrewInputWord = " הַשָּׂרִים ";
            const string expectedRussianWordResult = " асарим ";
            Assert.AreEqual(expectedRussianWordResult, new Hebrew2RussianTranslit().ConvertLine(hebrewInputWord));
            Assert.AreEqual("нигшу", new Hebrew2RussianTranslit().ConvertLine("נִגְּשׁוּ"));

            const string hebrewInput = "כְכַלּוֹת אֵלֶּה, נִגְּשׁוּ אֵלַי הַשָּׂרִים לֵאמֹר--לֹא-נִבְדְּלוּ הָעָם יִשְׂרָאֵל וְהַכֹּהֲנִים וְהַלְוִיִּם, מֵעַמֵּי הָאֲרָצוֹת כְּתֹעֲבֹתֵיהֶם";
            const string expectedRussianResult = "хехалот элэ, нигшу элай асарим лэмор--ло-нивделу аам йисраэль веакоаним веалвийим, мэамэй аарацот кетоавотээм";
            //const string expectedRussianResult = "хехалот элэ, нигшу элай ашарим лэмор--ло-нивделу аам йишраэль веахоаним веалвийим, мэамэй аарацот хетоавотээм";
            Hebrew2RussianTranslit translit = new Hebrew2RussianTranslit();
            string actualRussianResult = translit.ConvertLine(hebrewInput);
            Assert.AreEqual(expectedRussianResult, actualRussianResult);
        }

        // Правило такое: 
        //  в конце слова - если идут камац (или патах), 
        //  затем юд и вав (последняя буква в слове): 
        //      будет всегда -ав (а не -айв).
        // TODO: insert the rule into project page
        [TestMethod]
        public void Test_2011_04_08_Issue1()
        {
            const string hebrewInputWord = "בָּנָיו";
            const string expectedRussianWordResult = "банав";
            Assert.AreEqual(expectedRussianWordResult, new Hebrew2RussianTranslit().ConvertLine(hebrewInputWord));
        }
        [TestMethod]
        public void Test_2011_04_08_Issue2()
        {
            const string hebrewInputWord = "בַּעֲוֹנוֹתֵינוּ";
            const string expectedRussianWordResult = "баавонотэну";
            Assert.AreEqual(expectedRussianWordResult, new Hebrew2RussianTranslit().ConvertLine(hebrewInputWord));
        }

        // шва-нах (не произносится) после хирик
        [TestMethod]
        public void Test_2011_04_08_Issue3()
        {
            const string hebrewInputWord = "שֶׁנִּתְמַעֵט";
            const string expectedRussianWordResult = "шэнитмаэт";
            Assert.AreEqual(expectedRussianWordResult, new Hebrew2RussianTranslit().ConvertLine(hebrewInputWord));
        }

        [TestMethod]
        public void Test_2011_04_10_Issue1()
        {
            const string hebrewInputWord = "בְּאִישׁוֹן";
            const string expectedRussianWordResult = "беишон";
            Assert.AreEqual(expectedRussianWordResult, new Hebrew2RussianTranslit().ConvertLine(hebrewInputWord));
        }

        [TestMethod]
        public void Issue_394()
        {
            const string hebrewInputWord = "מֵרֹאשׁ";
            const string expectedRussianWordResult = "мэрош";
            Assert.AreEqual(expectedRussianWordResult, new Hebrew2RussianTranslit().ConvertLine(hebrewInputWord));
        }

        [TestMethod]
        public void Issue_395()
        {
            const string hebrewInputWord = "עִוּוּל";
            const string expectedRussianWordResult = "ивуль";
            Assert.AreEqual(expectedRussianWordResult, new Hebrew2RussianTranslit().ConvertLine(hebrewInputWord));
        }

        [TestMethod]
        public void Issue_399()
        {
            const string hebrewInputWord = "סְלִיחָה";
            const string expectedRussianWordResult = "слиха";
            Assert.AreEqual(expectedRussianWordResult, new Hebrew2RussianTranslit().ConvertLine(hebrewInputWord));
        }
    }
}